<?php
include_once '../common_mbs.inc.php';
include_once '../smarty.inc.php';

//判断访问权限
$admin_index_module_obj = new osgh_admin_index_module_cls();
$is_warrant = $admin_index_module_obj->is_have_warrant($_ADMIN_ID,'news_list');
if(!$is_warrant) tcmc_cls::ShowMsg("没有权限访问！", "../index_body.html");

$news_obj = new news_cls();
$act = trim($_INPUT['action']);
$news_id  = $_INPUT['news_id'];
if($act =='save')
{   
	if(empty($news_id)){
		$data = array(
			'news_title'   => $_INPUT['news_title'],
			'news_content' => $_INPUT['news_content'],
			'news_addtime' => time(),
			'news_adduser' => $_ADMIN_NAME,
			'page_title' => $_INPUT['page_title'],
			'page_keyword' => $_INPUT['page_keyword'],
			'page_des' => $_INPUT['page_des'],
			'news_type' => $_INPUT['news_type'],
		);
		$news_obj->add_news($data);
		tcmc_cls::ShowMsg("添加新闻成功！", "news_list.php");
	}else{
		  $up_data = array(										
						'news_title'   => $_INPUT['news_title'],
						'news_content' => $_INPUT['news_content'],
						'page_title' => $_INPUT['page_title'],
						'page_keyword' => $_INPUT['page_keyword'],
						'page_des' => $_INPUT['page_des'],
						'news_type' => $_INPUT['news_type'],					
					 );
		   $news_obj->update_news($up_data, $news_id);
		   tcmc_cls::ShowMsg("修改新闻成功！", "news_list.php");
	}
}elseif($act =='del'){
	$news_obj->del_news($news_id);
	tcmc_cls::ShowMsg("删除新闻成功！", "news_list.php");
}

?>
